package com.woniuxy.his.controller;


import com.woniuxy.his.common.Result;
import com.woniuxy.his.service.IPresDetailService;
import com.woniuxy.his.vo.OutMedicineDetailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 处方详情表 前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2021-08-24
 */
@RestController
@Slf4j
@CrossOrigin("*")
public class PresDetailController {

    @Resource
    private IPresDetailService presDetailService;

    @GetMapping("showMedicineMsgByPrescriptionId")
    public Result showMedicineMsgByPrescriptionId(Integer prescriptionId){
        log.info("药方id{}",prescriptionId);
        if(prescriptionId==null){
            return Result.fail("40005","空参数",null);
        }
        List<OutMedicineDetailVo> allMedicinesByPrescriptionId = presDetailService.getAllMedicineByPrescriptionId(prescriptionId);
        return Result.success("20000","success",allMedicinesByPrescriptionId);
    }

}

